<template>
    <div>
        <table>
            <tr>
                <td>编号</td>
                <td>图书名称</td>
                <td>作者</td>
            </tr>
            <tr v-for="item in books">
                <td v-text="item.id"></td>
                <td v-text="item.name"></td>
                <td v-text="item.author"></td>
            </tr>
        </table>

    </div>
</template>

<script>
    export default {
        name: "Book",
        data(){
            return {
                msg:'Hello Vue',
                books:[
                    {
                        id: 1,
                        name:"Java零基础实战",
                        author:"时宇",
                    },
                    {
                        id: 2,
                        name:"SpringBoot",
                        author:"时宇",
                    },
                    {
                        id: 3,
                        name:"Vue",
                        author:"时宇",
                    }
                ]
            }
        },
        created() {  //页面初始化之前
            axios.get('http://localhost:8181/book/findAll').then((res)=>{
                this.books=res.data
            })

        }

    }
</script>

<style scoped>

</style>